
*** Fighting the Disease or Manipulating the Data? Democracy, State Capacity, and the COVID-19 Pandemic***
*** For Replication ***

** Authors: Carl Henrik Knutsen and Palina Kolvani
** STATA 17 SE
**Windows 10 Enterprise, 11th Gen Intel(R) Core(TM) i7, 32GB RAM

use  "Main_dataset_Covid_Democracy_State_Capacity.dta", clear



sort country_id year
xtset country_id year 


************************
***Main Analysis***
************************


*DVs Economist: F.diff100k F.excess100k F.official100k 
*DVs Wang et al.: 
*Main IVs: v2x_polyarchy norm_v2clrspct
*clearly relevant controls: L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens
*relevant controls, but some concerns ptb: L5.e_pelifeex, share_older, 
*relevant but strong concern post-treatment: doctors_pc, hosp_beds_pc, resp_disease_prev 



* generate sample

regress F.official100k v2x_polyarchy , vce(hc3) 
gen sample = 1 if e(sample)
 
* bivariate correlations and descriptive stats

correlate F.official100k v2x_polyarchy if sample ==1

summarize F.official100k if v2x_polyarchy>0.49999 & sample ==1

summarize F.official100k if v2x_polyarchy<0.5  & sample == 1



correlate F.official100k norm_v2clrspct if sample ==1
correlate F.official100k v2stcritrecadm if sample ==1
correlate F.official100k v2stfisccap if sample ==1
correlate F.official100k L4.Capacity if sample ==1





*Figure 2
graph twoway (lfit official100k L.v2x_polyarchy )  (scatter official100k v2x_polyarchy, mlabel(country) mlabsize(vsmall) mlabcolor(black)), xtitle(Polyarchy (2019)) ytitle(Official deaths (per 100k population)) legend(off) graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white))  
graph twoway (lfit official100k L.norm_v2clrspct if L.norm_v2clrspct>0 )  (scatter official100k L.norm_v2clrspct  if L.norm_v2clrspct>0 , mlabel(country) mlabsize(vsmall) mlabcolor(black)), xtitle(Impartial and rule-following admin (2019)) ytitle(Official deaths  (per 100k population)) legend(off) graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white)) xlabel(0 0.2 0.4 0.8 1)  


*Figure 3

graph twoway (lfit excess100k L.v2x_polyarchy )  (scatter excess100k v2x_polyarchy, mlabel(country) mlabsize(vsmall) mlabcolor(black)), xtitle(Polyarchy (2019)) ytitle(Excess deaths (per 100k population)) legend(off) graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white))  
graph twoway (lfit excess100k L.norm_v2clrspct if L.norm_v2clrspct>0 )  (scatter excess100k L.norm_v2clrspct if L.norm_v2clrspct>0, mlabel(country) mlabsize(vsmall) mlabcolor(black)), xtitle(Impartial and rule-following admin (2019)) ytitle(Excess deaths (per 100k population)) legend(off) graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white)) 

correlate F.excess100k v2x_polyarchy if sample ==1  
correlate F.excess100k norm_v2clrspct if sample ==1

*Figure 4
graph twoway (lfit diff100k L.v2x_polyarchy )  (scatter diff100k v2x_polyarchy, mlabel(country) mlabsize(vsmall) mlabcolor(black)), xtitle(Polyarchy (2019)) ytitle(Official deaths minus excess deaths (per 100k population)) legend(off) graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white))  
graph twoway (lfit diff100k L.norm_v2clrspct if L.norm_v2clrspct>0 )  (scatter diff100k L.norm_v2clrspct if L.norm_v2clrspct>0 , mlabel(country) mlabsize(vsmall) mlabcolor(black)), xtitle(Impartial and rule-following admin (2019)) ytitle(Official deaths minus excess deaths (per 100k population)) legend(off) graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white)) 

correlate F.diff100k v2x_polyarchy if sample ==1  
correlate F.diff100k norm_v2clrspct if sample ==1  

summarize F.diff100k if v2x_polyarchy>0.49999 & sample ==1  
summarize F.diff100k if v2x_polyarchy<0.5 & sample ==1  

*Table 2 (Economist measure)
regress F.official100k v2x_polyarchy norm_v2clrspct, vce(hc3)
estimates store a
regress F.official100k v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
estimates store b
regress F.official100k v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older F.doctors_pc F.hosp_beds_pc F.resp_disease_prev , vce(hc3) 
estimates store c

regress F.excess100k v2x_polyarchy norm_v2clrspct, vce(hc3)
estimates store a1
regress F.excess100k v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
estimates store b1
regress F.excess100k v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older F.doctors_pc F.hosp_beds_pc F.resp_disease_prev , vce(hc3) 
estimates store c1

regress F.diff100k v2x_polyarchy norm_v2clrspct, vce(hc3)
estimates store a2
regress F.diff100k v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
estimates store b2
regress F.diff100k v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older F.doctors_pc F.hosp_beds_pc F.resp_disease_prev , vce(hc3) 
estimates store c2
estout a b c a1 b1 c1 a2 b2 c2, cells(b(star fmt(%9.2f)) t(par fmt(%9.2f))) rename(s_mil_loggdp Ln_GDP_pc s_bmr_democracy BMR_regime v2clrspct Impartial_public_admin s_bmr_democracy_trans BMR_democratic_transition v2x_Polyarchy Polyarchy) starlevels (* 0.10 ** 0.05 *** 0.01) stats (N r2)style (fixed)




*** Models behind Figure 5 with Hanson and Sigman state capacity measure (Table A-2 in the Appendix)
regress F.official100k v2x_polyarchy L4.normCap, vce(hc3)
estimates store a
regress F.official100k v2x_polyarchy L4.normCap L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
estimates store b
regress F.official100k v2x_polyarchy L4.normCap L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older F.doctors_pc F.hosp_beds_pc F.resp_disease_prev , vce(hc3) 
estimates store c

regress F.excess100k v2x_polyarchy L4.normCap, vce(hc3)
estimates store a1
regress F.excess100k v2x_polyarchy L4.normCap L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
estimates store b1
regress F.excess100k v2x_polyarchy L4.normCap L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older F.doctors_pc F.hosp_beds_pc F.resp_disease_prev , vce(hc3) 
estimates store c1

regress F.diff100k v2x_polyarchy L4.normCap, vce(hc3)
estimates store a2
regress F.diff100k v2x_polyarchy L4.normCap L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
estimates store b2
regress F.diff100k v2x_polyarchy L4.normCap L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older F.doctors_pc F.hosp_beds_pc F.resp_disease_prev , vce(hc3) 
estimates store c2
estout a b c a1 b1 c1 a2 b2 c2, cells(b(star fmt(%9.2f)) t(par fmt(%9.2f))) rename(s_mil_loggdp Ln_GDP_pc s_bmr_democracy BMR_regime v2clrspct Impartial_public_admin s_bmr_democracy_trans BMR_democratic_transition v2x_Polyarchy Polyarchy) starlevels (* 0.10 ** 0.05 *** 0.01) stats (N r2)style (fixed)


*Figure 5
coefplot (a, label(M1)) (b, label(M2)) (c, label(M3)) (a1, label(M4)) (b1, label(M5)) (c1, label(M6)) (a2, label(M7)) (b2, label(M8)) (c2, label(M9)), bylabel(Timing relative to regime breakdown) keep(v2x_polyarchy) vertical yline(0)  
*edit in Graph Editor and save

coefplot (a, label(M1)) (b, label(M2)) (c, label(M3)) (a1, label(M4)) (b1, label(M5)) (c1, label(M6)) (a2, label(M7)) (b2, label(M8)) (c2, label(M9)), bylabel(Timing relative to regime breakdown) keep(L4.normCap) vertical yline(0) 
*edit in Graph Editor and save



**Table A-3 in the Appendix (used to produce Figure 6)
regress F.ihme_off_rate v2x_polyarchy norm_v2clrspct, vce(hc3)
estimates store a
regress F.ihme_off_rate v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
estimates store b
regress F.ihme_off_rate v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older F.doctors_pc F.hosp_beds_pc F.resp_disease_prev , vce(hc3) 
estimates store c

regress F.ihme_excess_rate v2x_polyarchy norm_v2clrspct, vce(hc3)
estimates store a1
regress F.ihme_excess_rate v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
estimates store b1
regress F.ihme_excess_rate v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older F.doctors_pc F.hosp_beds_pc F.resp_disease_prev , vce(hc3) 
estimates store c1

regress F.ihme_diff100k v2x_polyarchy norm_v2clrspct, vce(hc3)
estimates store a2
regress F.ihme_diff100k v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
estimates store b2
regress F.ihme_diff100k v2x_polyarchy norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older F.doctors_pc F.hosp_beds_pc F.resp_disease_prev , vce(hc3) 
estimates store c2

estout a b c a1 b1 c1 a2 b2 c2, cells(b(star fmt(%9.2f)) t(par fmt(%9.2f))) rename(s_mil_loggdp Ln_GDP_pc s_bmr_democracy BMR_regime v2clrspct Impartial_public_admin s_bmr_democracy_trans BMR_democratic_transition v2x_Polyarchy Polyarchy) starlevels (* 0.10 ** 0.05 *** 0.01) stats (N r2)style (tex)


**Figure 6
coefplot (a, label(M1)) (b, label(M2)) (c, label(M3)) (a1, label(M4)) (b1, label(M5)) (c1, label(M6)) (a2, label(M7)) (b2, label(M8)) (c2, label(M9)), bylabel(Timing relative to regime breakdown) keep(v2x_polyarchy) vertical yline(0) 
*edit in Graph Editor and save
coefplot (a, label(M1)) (b, label(M2)) (c, label(M3)) (a1, label(M4)) (b1, label(M5)) (c1, label(M6)) (a2, label(M7)) (b2, label(M8)) (c2, label(M9)), bylabel(Timing relative to regime breakdown) keep(norm_v2clrspct) vertical yline(0) 
*edit in Graph Editor and save


**Figure 7

** Economist data


regress F.excess100k c.v2x_polyarchy##c.norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
margins, dydx(v2x_polyarchy) at(norm_v2clrspct =(0(0.1)1))
marginsplot, recast(line) plotopts(lwidth(medthick)) recastci(rline) ciopts(lwidth(vthin) lpattern(longdash)) level(95) xlabel(0(0.1)1) graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white)) ytitle(Marginal effect of Polyarchy) title (Excess deaths is outcome; Intermediate set controls)

regress F.diff100k c.v2x_polyarchy##c.norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
margins, dydx(v2x_polyarchy) at(norm_v2clrspct =(0(0.1)1))
marginsplot, recast(line) plotopts(lwidth(medthick)) recastci(rline) ciopts(lwidth(vthin) lpattern(longdash)) level(95) xlabel(0(0.1)1) graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white)) ytitle(Marginal effect of Polyarchy) title (Under-reporting deaths is outcome; Intermediate set controls)


** Wang et al data
regress F.ihme_excess_rate c.v2x_polyarchy##c.norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
margins, dydx(v2x_polyarchy) at(norm_v2clrspct =(0(0.1)1))
marginsplot, recast(line) plotopts(lwidth(medthick)) recastci(rline) ciopts(lwidth(vthin) lpattern(longdash)) level(95) xlabel(0(0.1)1) graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white)) ytitle(Marginal effect of Polyarchy) title (Excess deaths is outcome; Intermediate set controls)

regress F.ihme_diff100k  c.v2x_polyarchy##c.norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
margins, dydx(v2x_polyarchy) at(norm_v2clrspct =(0(0.1)1))
marginsplot, recast(line) plotopts(lwidth(medthick)) recastci(rline) ciopts(lwidth(vthin) lpattern(longdash)) level(95) xlabel(0(0.1)1) graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white)) ytitle(Marginal effect of Polyarchy) title (Under-reporting deaths is outcome; Intermediate set controls)



**Figure 8


** Economist data 


regress F.excess100k c.v2x_polyarchy##c.norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
margins, dydx(norm_v2clrspct) at(v2x_polyarchy =(0(0.1)1))
marginsplot, recast(line) plotopts(lwidth(medthick)) recastci(rline) ciopts(lwidth(vthin) lpattern(longdash)) level(95) xlabel(0(0.1)1) name(lineb2) graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white)) ytitle(Marginal effect of Impartial administration) title (Excess deaths is outcome; Intermediate set controls)

regress F.diff100k c.v2x_polyarchy##c.norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
margins, dydx(norm_v2clrspct) at(v2x_polyarchy =(0(0.1)1))
marginsplot, recast(line) plotopts(lwidth(medthick)) recastci(rline) ciopts(lwidth(vthin) lpattern(longdash)) level(95) xlabel(0(0.1)1)  graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white)) ytitle(Marginal effect of Impartial administration) title (Under-reporting deaths is outcome; Intermediate set controls)


** Wang et al data

regress F.ihme_excess_rate c.v2x_polyarchy##c.norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
margins, dydx(norm_v2clrspct) at(v2x_polyarchy =(0(0.1)1))
marginsplot, recast(line) plotopts(lwidth(medthick)) recastci(rline) ciopts(lwidth(vthin) lpattern(longdash)) level(95) xlabel(0(0.1)1)  graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white)) ytitle(Marginal effect of Impartial administration) title (Excess deaths is outcome; Intermediate set controls)

regress F.ihme_diff100k c.v2x_polyarchy##c.norm_v2clrspct L5.s_far_Maddison_gdppc_1990_estima L5.s_far_Maddison_pop_estimate L5.popdens L5.e_pelifeex F.share_older, vce(hc3) 
margins, dydx(norm_v2clrspct) at(v2x_polyarchy =(0(0.1)1))
marginsplot, recast(line) plotopts(lwidth(medthick)) recastci(rline) ciopts(lwidth(vthin) lpattern(longdash)) level(95) xlabel(0(0.1)1)  graphregion(fcolor(white) ifcolor(white)) plotregion(fcolor(white) ifcolor(white)) ytitle(Marginal effect of Impartial administration) title (Under-reporting deaths is outcome; Intermediate set controls)






